package com.practice.controller.admin;

import com.practice.common.result.Result;
import com.practice.pojo.admin.dto.AdminLoginDTO;
import com.practice.service.admin.AdminIndexService;
import com.practice.service.admin.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController("adminIndexController")
@RequestMapping("/index")
public class AdminIndexController {
    @Autowired
    private AdminIndexService adminIndexService;
    @Autowired
    private LoginService loginService;

    /**
     * 获取系统配置
     * @return
     */
    @GetMapping("/getConfig")
    public Result getConfig(){
        return adminIndexService.config();
    }

    @PostMapping("/login")
    public Result login(@RequestBody AdminLoginDTO adminLoginDTO){
        return loginService.login(adminLoginDTO);
    }

    @PostMapping("/profile")
    public Result profile(){
        return Result.success(adminIndexService.profile());
    }

    @GetMapping("/baseInfo")
    public Result baseInfo(){
        return Result.success(adminIndexService.baseInfo());
    }

}
